filter won't turn on

The following script builds a filter of objects with a value in either the RID or Proposed RID attribute columns. The Proposed RID attribute defaults to NC:

filtering off
for o in m do {
rid = o."RID"
prid = o."Proposed RID"
if ((!null rid && !isDeleted(o)) || (prid != "NC")) {
accept o
ridcount++
}
else {
reject o
}
}
filtering on

If I select an object that contains a value in o."RID" or other than "NC" in o."Proposed RID"
and run the script,the filter will turn on.
If the selected object does not have a value in either of these fields, the filter does not turn on. There are 12 objects that contain information in "RID" and 3 oobjects that contain information in "Proposed RID".

Can anyone help?
lahines - Tue Feb 07 13:54:01 EST 2012

Re: filter won't turn on
llandale - Tue Feb 07 14:36:28 EST 2012

Is it possible that "rid" or "proposed rid" are attr-DXL, displaying info from some other module? If so, that module may open making it "current", and your "filtering on" statement would apply to that. More likely you've opened a module after opening "m" and it is current.

Put this first:
  • "print name(current Module) "\n"
to see if you have a problem. In any event, put this before both of your "filtering" statements.
  • "current = m"

You know you cannot save this accept/reject "Filter" in a view.

-Louie

Re: filter won't turn on
lahines - Wed Feb 08 07:10:52 EST 2012

llandale - Tue Feb 07 14:36:28 EST 2012
Is it possible that "rid" or "proposed rid" are attr-DXL, displaying info from some other module? If so, that module may open making it "current", and your "filtering on" statement would apply to that. More likely you've opened a module after opening "m" and it is current.

Put this first:

  • "print name(current Module) "\n"
to see if you have a problem. In any event, put this before both of your "filtering" statements.
  • "current = m"

You know you cannot save this accept/reject "Filter" in a view.

-Louie

Thanks llandale but still a mystery.
The print statements reveal that the module does not change.
The filter is not for a view, but is being created for the next step, where information is only being extracted from the filtered objects.

The action happens entirely in the code bit I posted. The filter never turns on in the one instance, as if the instruction didn't exist.
Yet it doesn't skip over the instruction because print instructions on each side of the filtering on instruction perform correctly in either instance.

One additional piece of information-- This problem only occurs when a trigger script has run. This trigger script runs whenever a new object is created and comprises two parts. The first part places a space in the object text field to supress any Object numbering. The second part fills in an index attribute with the next highest index number. When this trigger script separated into two parts, and only the first part of the trigger script runs when a new object is created, followed then by manually running the second part after clicking on and selecting the new object, the filter turns on. Only when the combined trigger script is run does the filter not turn on.

Re: filter won't turn on
lahines - Wed Feb 08 08:59:24 EST 2012

llandale - Tue Feb 07 14:36:28 EST 2012
Is it possible that "rid" or "proposed rid" are attr-DXL, displaying info from some other module? If so, that module may open making it "current", and your "filtering on" statement would apply to that. More likely you've opened a module after opening "m" and it is current.

Put this first:

  • "print name(current Module) "\n"
to see if you have a problem. In any event, put this before both of your "filtering" statements.
  • "current = m"

You know you cannot save this accept/reject "Filter" in a view.

-Louie

Finally,
If the current object is not a member of the filtered set, the filter will not turn on.

Re: filter won't turn on
llandale - Wed Feb 08 16:32:49 EST 2012

lahines - Wed Feb 08 07:10:52 EST 2012
Thanks llandale but still a mystery.
The print statements reveal that the module does not change.
The filter is not for a view, but is being created for the next step, where information is only being extracted from the filtered objects.

The action happens entirely in the code bit I posted. The filter never turns on in the one instance, as if the instruction didn't exist.
Yet it doesn't skip over the instruction because print instructions on each side of the filtering on instruction perform correctly in either instance.

One additional piece of information-- This problem only occurs when a trigger script has run. This trigger script runs whenever a new object is created and comprises two parts. The first part places a space in the object text field to supress any Object numbering. The second part fills in an index attribute with the next highest index number. When this trigger script separated into two parts, and only the first part of the trigger script runs when a new object is created, followed then by manually running the second part after clicking on and selecting the new object, the filter turns on. Only when the combined trigger script is run does the filter not turn on.

Next time use the DXL forum.

Add this after your filtering(on) statement.
  • print "filtering is: " filtering(m) "\n"

lol that's a pretty big "piece" of information.

Post the trigger code and the code that deploys it. I'll figure it out.

Please delete all other columns and verify you get the same results. Hate to find out you've got some naughty layout messing you up.

  • Louie

Forget that filtering approach. In the "next part" do this:

bool HasAnyRid(Object obj) 
{  rid = o.
"RID" prid = o.
"Proposed RID" 

if ((!

null rid && !isDeleted(o)) || (prid != 
"NC")) 
// then 

return(

true) 

else 

return(

false) 
} 
// ...  
// The "next part" should eschew the "for o in mod" loop in favor of this: 

for o in entire mod 

do 
{  

if (isDeleted(o)) 

continue 

if (!HasAnyRid(o)) 

continue bla bla bla 
}


You could also just not activate the filtering, and 

do 

this in your 
"next step" 

for o in entire mod 

do 
{  

if (isDeleted(o)) 

continue 

if (!isFiltered(o)) 

continue bla bla bla 
}

-Louie

Re: filter won't turn on
lahines - Mon Feb 13 08:28:59 EST 2012

llandale - Wed Feb 08 16:32:49 EST 2012
Next time use the DXL forum.

Add this after your filtering(on) statement.

  • print "filtering is: " filtering(m) "\n"

lol that's a pretty big "piece" of information.

Post the trigger code and the code that deploys it. I'll figure it out.

Please delete all other columns and verify you get the same results. Hate to find out you've got some naughty layout messing you up.

  • Louie

Forget that filtering approach. In the "next part" do this:

bool HasAnyRid(Object obj) 
{  rid = o.
"RID" prid = o.
"Proposed RID" 

if ((!

null rid && !isDeleted(o)) || (prid != 
"NC")) 
// then 

return(

true) 

else 

return(

false) 
} 
// ...  
// The "next part" should eschew the "for o in mod" loop in favor of this: 

for o in entire mod 

do 
{  

if (isDeleted(o)) 

continue 

if (!HasAnyRid(o)) 

continue bla bla bla 
}


You could also just not activate the filtering, and 

do 

this in your 
"next step" 

for o in entire mod 

do 
{  

if (isDeleted(o)) 

continue 

if (!isFiltered(o)) 

continue bla bla bla 
}

-Louie

1) I have now set a "Favorite" for the DXL forum. This makes it easire to find.
2) The "if (!HasAnyRid(o)) continue" statement gives errors, the first being "HasAnyRid is incorrect argument for !", and incorrect afguments for function (HasAnyRid). I suspect I left something out, but I don't know what that would be.

Re: filter won't turn on
llandale - Tue Feb 14 10:25:26 EST 2012

lahines - Mon Feb 13 08:28:59 EST 2012
1) I have now set a "Favorite" for the DXL forum. This makes it easire to find.
2) The "if (!HasAnyRid(o)) continue" statement gives errors, the first being "HasAnyRid is incorrect argument for !", and incorrect afguments for function (HasAnyRid). I suspect I left something out, but I don't know what that would be.

So much for scribbling.

bool HasAnyRid(Object obj) 
{  string rid = obj.
"RID" string prid = obj.
"Proposed RID" 

if ((!

null rid && !isDeleted(obj)) || (prid != 
"NC")) 
// then 

return(

true) 

else 

return(

false) 
} 
// ...  
// The "next part" should eschew the "for o in mod" loop in favor of this: Object o Module mod = current 

for o in entire mod 

do 
{  

if (isDeleted(o)) 

continue 

if (!HasAnyRid(o)) 

continue 
// bla bla bla 
}

Re: filter won't turn on
lahines - Thu Feb 16 07:21:04 EST 2012

llandale - Tue Feb 14 10:25:26 EST 2012
So much for scribbling.


bool HasAnyRid(Object obj) 
{  string rid = obj.
"RID" string prid = obj.
"Proposed RID" 

if ((!

null rid && !isDeleted(obj)) || (prid != 
"NC")) 
// then 

return(

true) 

else 

return(

false) 
} 
// ...  
// The "next part" should eschew the "for o in mod" loop in favor of this: Object o Module mod = current 

for o in entire mod 

do 
{  

if (isDeleted(o)) 

continue 

if (!HasAnyRid(o)) 

continue 
// bla bla bla 
}

Thanks for the help.
This is a good alternative and now works great.